$(function(){
	
	onlineMyOrderList();
	//医生列表渲染
	function onlineMyOrderList(){
 		var param = {"patientid":USERID};
		function callBackSlider(data){
			console.log(data);
			if(data.result==""){
				$(".noOrder").show();
				$(".my-prescriptionList").hide();
			}
			var html = "";
			for(i in data){
				html+='<li orderid="'+data[i].id+'">'
					+'<div class="user">'
						+data[i].doctorName+'-处方单'
						+'<span>查看详情 ></span>'
					+'</div>'
					+'<div class="drugs">'
						+'<div class="time">'
							+'诊断时间：'+data[i].createtime
						+'</div>'
						+'<div class="img mui-ellipsis"><div class="picture">';
							for(j in data[i].prescriptionDetailList){
								html+='<div><img src="'+data[i].prescriptionDetailList[j].thumbnail+'"/></div>';
							}
						html+='</div>'
						if(data[i].prescriptionDetailList.length>3){
								html+='<div class="more">...</div>';
							}
						html+='</div>'
						+'<div class="money">'
							+'总共'+data[i].prescriptionDetailList.length+'件商品<font>总价：<span class="color_blue">￥'+data[i].totlmoney+'</span></font>'
							if(data[i].isbuy=="1"){
								html +='<div class="color_blue">已购买</div>';
							}else{
								html +='<div class="findMedical">一键寻药</div>';
							}
						html +='</div>'
					+'</div>'
				+'</li>';
				
			}
			$(".my-prescriptionList ul").append(html);
		}
		onlineContinuationModule.onlineOrderList(param,callBackSlider);
	}
	
	$(".my-prescriptionList .user span").on("click",function(){
		var id = $(this).parent().parent().attr("orderid");
		location.href = "../../html/onlineContinuation/prescription-detail.html?id="+id;
	});
	
	$(".my-prescriptionList .drugs .findMedical").click(function(){
		var id = $(this).parent().parent().parent().attr("orderid");
		location.href = "../../html/onlineContinuation/drug-delivery.html?id="+id;
	});
});
